//-------------------------------------------------------------------
//	Copyright (c) 2012-2014 Zhirnov Andrey
//	This file is part of the "UXGEN-ES" project.
//	See copyright notice in "Engine.h".
//-------------------------------------------------------------------

#include "UI/Systems/UserInterface.h"

namespace Engine
{
namespace UI
{
	
/*
=================================================
	constructor
=================================================
*/
	UserInterface::UserInterface (const EngineSubSystemsRef ess) :
		BaseObject(ess), _texMngr(ess), _localeMngr(ess)
	{
		ESS()->SetUserInterface( this );
	}

/*
=================================================
	destructor
=================================================
*/
	UserInterface::~UserInterface ()
	{
		Ptr< ResourceManager >	rm = ESS()->GetResourceManager();

		if ( rm.IsNotNull() )
		{
			_uiLoader.Unregister( rm );
		}

		ESS()->SetUserInterface( null );
	}
	
/*
=================================================
	InitResources
=================================================
*/
	void UserInterface::InitResources ()
	{
		Ptr< ResourceManager >	rm = ESS()->GetResourceManager();

		CHECK_ERR( rm.IsNotNull(), void() );

		_uiLoader.Register( rm );
	}


}	// UI
}	// Engine